package com.scc.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.scc.mapper.EmpOperationLogMapper;
import com.scc.pojo.EmpOperationLog;
import com.scc.pojo.PageBean;
import com.scc.service.EmpOperationLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Service
public class EmpOperationLogServiceImpl implements EmpOperationLogService {
    //注入mapper层
    @Autowired
    private EmpOperationLogMapper empOperationLogMapper;

    ///管理员对员工操作日志的获取和查询
    @Override
    public PageBean getEmpOperationLogMsg(Integer page, Integer pageSize, String account, String name, String operationType, LocalDateTime startTime, LocalDateTime endTime) {
        PageHelper.startPage(page, pageSize);
        //返回一个集合
        List<EmpOperationLog> empOperationLogList = empOperationLogMapper.selectEmpOperationLogMsg(name,account,operationType,startTime,endTime);
        PageInfo<EmpOperationLog> pageInfo = new PageInfo<>(empOperationLogList);
        return new PageBean(pageInfo.getTotal(),pageInfo.getList());
    }

    //管理员对员工日志的删除操作
    @Override
    public void deleteEmpOperationLogsMsg(List<Integer> ids) {
        empOperationLogMapper.deleteEmpOperationLogsMsg(ids);
    }
}
